package com.attedu.jdbc.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * @author tune_the last
 * @date 2025/11/4 - 9:33
 * 数据库的工具类：专门用于获取数据库的连接对象Connection;
 */
public class DBUtil {

    static {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
    public static Connection getConnection() throws SQLException {
        return DriverManager.getConnection("jdbc:mysql://localhost:3306/tedu?characterEncoding=utf8", "root", "ASD13579asd");
    }

}
